package com.ssh.action;

import java.util.List;
import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.ssh.biz.UsersBiz;
import com.ssh.entity.Users;

public class UsersAction extends ActionSupport {

	private Users user;

	private UsersBiz ubiz;
	
	public void setUbiz(UsersBiz ubiz) {
		this.ubiz = ubiz;
	}

	public Users getUser() {
		return user;
	}

	public void setUser(Users user) {
		this.user = user;
	}
	
	public String login()
	{
		Users us = ubiz.login(user);
		if(us==null)
		{
			return ERROR;
			
		}else
		{
			return SUCCESS;
		}
	}
	
	public String queryallusers()
	{
		List users = ubiz.queryUsers();
		Map request = (Map) ActionContext.getContext().get("request");
	    request.put("users", users);
	    return SUCCESS;
	}
}
